***Revision Jul 9, 2022
clear
set more off
global outfile "..\Data\Revision codes\output_table"


***************
*** TABLE 1 *** 
***************
u main_data_submission.dta

* Panel A: All sample firms (2003-2013)
eststo clear
estpost tabstat at lnasset totdebt_at debtissue_lagat xrd_at ppent_at, s(mean sd p25 p50 p75 n) columns(statistics)
esttab using "$outfile\Table1A.csv", cell("mean(fmt(2)) sd(fmt(2)) p25(fmt(2)) p50(fmt(2)) p75(fmt(2)) count(fmt(0))") label nonumber replace unstack noobs

* Panel B: Pre-treatment comparisons (2003-2007)
eststo clear
estpost tabstat at lnasset totdebt_at debtissue_lagat xrd_at ppent_at totcollateral ngrant nsumselfcite ninv if fyear<2008, s(n mean sd p25 p50 p75) by(treat) columns(statistics) nototal
esttab using "$outfile\Table1B.csv", cell("mean(fmt(2)) count(fmt(0))") label nonumber replace unstack noobs
estpost ttest at lnasset totdebt_at debtissue_lagat xrd_at ppent_at totcollateral ngrant nsumselfcite ninv if fyear<2008, by(treat) 
esttab using "$outfile\Table1B.csv", cell("b(lab(Difference) star fmt(2))") nonotes append label star(* 0.10 ** 0.05 *** 0.01) noobs

clear

***************
*** TABLE 2 *** 
***************
u main_data_submission.dta

* Panel A: Changes in level
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(ind_year_fe DE) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(state_ind_fe fyear) vce(cluster state)
esttab using "$outfile\Table2A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Changes in flow
eststo clear
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(ind_year_fe DE) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(state_ind_fe fyear) vce(cluster state)
esttab using "$outfile\Table2B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 3 *** 
***************
u false_data_submission.dta

* Panel A: Changes in level
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(ind_year_fe DE) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(state_ind_fe fyear) vce(cluster state)
esttab using "$outfile\Table3A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Changes in flow
eststo clear
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(ind_year_fe DE) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(state_ind_fe fyear) vce(cluster state)
esttab using "$outfile\Table3B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 4 *** 
***************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post , absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post , absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post , absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post , absorb(fyear state_ind_fe) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post c.prexrd##i.post c.prepatstock##i.post , absorb(gvkey fyear) vce(robust)
eststo: qui ppmlhdfe totcollateral i.treat##i.post c.prexrd##i.post c.prepatstock##i.post , absorb(gvkey ind_year_fe) vce(robust)
esttab using "$outfile\Table4.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 5 *** 
***************
* Panel A: Types of debt
u main_data_submission.dta

eststo clear
eststo: qui reghdfe bank_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe ltd_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe dlc_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)	
eststo: qui reghdfe dd1_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe d1d2_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\Table5A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Secured lonas and interest rates
u loan_data_submission.dta

eststo clear
eststo: qui reghdfe loan_secured i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe loan_secured i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe loan_unsecured i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe loan_unsecured i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lspread_secured i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lspread_secured i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lspread_unsecured i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lspread_unsecured i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\Table5B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 6 *** 
***************
u main_data_submission.dta

* Panel A: R&D investments
eststo clear
eststo: qui reghdfe lxrd i.treat##i.post i.d_highpatstock##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lxrd i.treat##i.post i.d_highpatstock##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lxrd i.treat##i.post i.d_highpatstock##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe lxrd i.treat##i.post i.d_highpatstock##i.post, absorb(fyear state_ind_fe) vce(cluster state)
eststo: qui reghdfe xrd_invemp i.treat##i.post i.d_highpatstock##i.post c.maxpreemp##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe xrd_invemp i.treat##i.post i.d_highpatstock##i.post c.maxpreemp##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe xrd_invemp i.treat##i.post i.d_highpatstock##i.post c.maxpreemp##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe xrd_invemp i.treat##i.post i.d_highpatstock##i.post c.maxpreemp##i.post, absorb(fyear state_ind_fe) vce(cluster state)
esttab using "$outfile\Table6A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Physical investments
eststo clear
eststo: qui reghdfe ppent_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe ppent_at i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe ppent_at i.treat##i.post, absorb(state ind_year_fe) vce(cluster state)
eststo: qui reghdfe ppent_at i.treat##i.post, absorb(fyear state_ind_fe) vce(cluster state)
esttab using "$outfile\Table6B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 7 *** 
***************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe lead2lgrant i.treat##i.post i.d_xrd##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post , absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post , absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(fyear state_ind_fe) vce(cluster state)
esttab using "$outfile\Table7.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


***************
*** TABLE 8 *** 
***************
u main_data_submission.dta

* Panel A: Debt financing
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post##c.nca_index, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.nca_index, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.holdup, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.holdup, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.preavgselfcite, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.preavgselfcite, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.pcthighprox, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.pcthighprox, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\Table8A.csv", keep(1.treat#1.post 1.treat#1.post#c.nca_index 1.treat#1.post#1.holdup 1.treat#1.post#c.preavgselfcite 1.treat#1.post#c.pcthighprox) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Patenting and pledged patents
eststo clear
eststo: qui reghdfe lead2lgrant i.treat##i.post##c.nca_index, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##i.holdup, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##c.preavgselfcite, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##i.d_highprox, absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\Table8B.csv", keep(1.treat#1.post 1.treat#1.post#c.nca_index 1.treat#1.post#1.holdup 1.treat#1.post#c.preavgselfcite 1.treat#1.post#1.d_highprox) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

eststo: qui ppmlhdfe totcollateral i.treat##i.post##c.nca_index, absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##i.holdup, absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##c.preavgselfcite, absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##c.pcthighprox, absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\Table8B.csv", keep(1.treat#1.post 1.treat#1.post#c.nca_index 1.treat#1.post#1.holdup 1.treat#1.post#c.preavgselfcite 1.treat#1.post#c.pcthighprox) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append

clear


***************
*** TABLE 9 *** 
***************
u main_data_submission.dta

* Panel A: Self citation
eststo clear
eststo: qui reghdfe lsumselfcite i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lsumselfcite i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lsumselfcite i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe lsumselfcite i.treat##i.post, absorb(fyear state_ind_fe) vce(cluster state)
eststo: qui ppmlhdfe nsumselfcite i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe nsumselfcite i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\Table9A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Inventor collaboration
eststo clear
eststo: qui reghdfe ninvnm i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe ninvnm i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe ninvnm i.treat##i.post, absorb(ind_year_fe state) vce(cluster state)
eststo: qui reghdfe ninvnm i.treat##i.post, absorb(fyear state_ind_fe) vce(cluster state)
esttab using "$outfile\Table9B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


*************************
*** TABLE 10, PANEL A *** 
*************************
u matching_data_submission.dta

*Panel A: Propensity score matching diagnostics
local var lev_growth levissue_growth size_growth coll_growth grantgrowth leadgrantgrowth meancitecnt_growth effgrant_growth at xrd_at effgrant lgrant lsumcite mtb ppent_at che_at capx_at roa
probit treat `vars', vce(cluster sic)
predict phat
gen phat2=sic+phat
psmatch2 treat, pscore(phat2) common neighbor(1) caliper(1)

log using "$outfile\Table10A.txt",text 
pstest `vars', both label
log close

clear


***************************
*** TABLE 10, PANEL B&C *** 
***************************
u matched_data_submission.dta

* Panel B: Propensity score matching regression - Main results
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey ind_year_fe)  vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post, absorb(gvkey ind_year_fe)  vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe xrd_at i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lsumselfcite i.treat##i.post , absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe ninv i.treat##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\Table10B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel C: Propensity score matching regression - Holdup results
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post##c.nca_index, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##c.prenpctselfcite, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.d_highprox, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##c.nca_index, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##c.prenpctselfcite, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post##i.d_highprox, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##c.nca_index, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##c.prenpctselfcite, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post##i.d_highprox, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\Table10C.csv", keep(1.treat#1.post 1.treat#1.post#c.nca_index 1.treat#1.post#c.prenpctselfcite 1.treat#1.post#1.d_highprox) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


****************
*** FIGURE 1 *** 
****************
u main_data_submission.dta

reghdfe totdebt_at i.treat##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(95) title("") xtitle("") ytitle("Treatment effect") ylabel(,labsize(medsmall)) xlabel(2004 "-4" 2005 "-3" 2006 "-2" 2007 "-1" 2008 "0" 2009 "1" 2010 "2" 2011 "3" 2012 "4" 2013 "5") xline(2008) xtick(2004(2)2013)
graph save "$outfile\Figure1.png", replace

clear


*****************
*** TABLE A.1 ***
*****************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_age, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_age, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_cash, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_cash, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_agecash, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post##i.constr_agecash, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\IATable1.csv", keep(1.treat#1.post 1.treat#1.post#1.constr_age 1.treat#1.post#1.constr_cash 1.treat#1.post#1.constr_agecash) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


*****************
*** TABLE A.2 ***
*****************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "DE", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "UT"), absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable2.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace


eststo clear
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "DE", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "IL", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "IL", "NC", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post c.prepatstock##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "UT"), absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable2.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append


eststo clear
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "DE", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "IL", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "IL", "NC", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "UT"), absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable2.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append


eststo clear
eststo: qui reghdfe bank_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "DE", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "IL", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "NC", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "KS", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "MN", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "UT", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "WA"), absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post if !inlist(state, "CA", "DE", "IL", "NC", "KS", "MN", "UT"), absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable2.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append

clear


*****************
*** TABLE A.3 ***
*****************
u state_data_submission.dta

local econvar gdpgrowth_st percap_gdp_growth unemp_growth statetax_growth

log using "$outfile\IATable3.txt",text
foreach var of local econvar{  
	forv i=2006/2010{
	ttest `var' if fyear==`i', by(treat) 
	}
}
log close

clear


*****************
*** TABLE A.4 ***
*****************
u nevada_data_submission.dta

* Panel A: Debt financing and pledgeability
eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post, absorb(ind_fe fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post, absorb(ind_fe fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post , absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_xrd##i.post , absorb(ind_fe fyear) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post c.prexrd##i.post , absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe totcollateral i.treat##i.post c.prexrd##i.post , absorb(ind_fe fyear) vce(cluster state)
esttab using "$outfile\IATable4.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

* Panel B: Innovation activity
eststo clear
eststo: qui reghdfe lead2lgrant i.treat##i.post i.d_xrd##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post i.d_xrd##i.post, absorb(ind_fe fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post , absorb(gvkey fyear) vce(cluster state)
eststo: qui ppmlhdfe lead2ngrant i.treat##i.post i.d_xrd##i.post , absorb(ind_fe fyear) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post, absorb(ind_fe fyear) vce(cluster state)
esttab using "$outfile\IATable4.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append

clear


*****************
*** TABLE A.5 ***
*****************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post if sub0==1, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if sub1==1, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post if sub2==1, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post if sub0==1, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post if sub1==1, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe debtissue_lagat i.treat##i.post if sub2==1, absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable5.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


*****************
*** TABLE A.6 ***
*****************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_size##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_age##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_prof##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_highpatstock##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_xrd##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_highpretax##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_ppent##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_mtb##i.post, absorb(gvkey fyear) vce(cluster state)
eststo: qui reghdfe totdebt_at i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_highpatstock##i.post i.d_xrd##i.post i.d_mtb##i.post i.d_prof##i.post , absorb(gvkey fyear) vce(cluster state)
esttab using "$outfile\IATable6.csv", keep(1.treat#1.post 1.d_size#1.post 1.d_age#1.post 1.d_highpretax#1.post 1.d_ppent#1.post 1.d_ppent#1.post 1.d_mtb#1.post 1.d_prof#1.post 1.d_highpatstock#1.post 1.d_xrd#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


*****************
*** TABLE A.7 ***
*****************
u main_data_submission.dta

eststo clear
eststo: qui reghdfe debtissue_lagat i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe totcollateral_debt i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe bank_at i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe effgrant i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe lsumselfcite i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe ninv i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post i.d_xrd##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
eststo: qui reghdfe xrd_invemp i.treat##i.post i.d_size##i.post i.d_age##i.post i.d_highpretax##i.post i.d_ppent##i.post i.d_mtb##i.post i.d_prof##i.post i.d_highpatstock##i.post, absorb(gvkey ind_year_fe) vce(cluster state)
esttab using "$outfile\IATable7.csv", keep(1.treat#1.post 1.d_size#1.post 1.d_age#1.post 1.d_highpretax#1.post 1.d_ppent#1.post 1.d_ppent#1.post 1.d_mtb#1.post 1.d_prof#1.post 1.d_highpatstock#1.post 1.d_xrd#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


*************************
*** TABLE A.8 PANEL A ***
*************************
* Panel A: State-level wage of innovative occupations

u occwage_data_submission.dta

eststo clear
eststo: qui reghdfe A_MEAN i.treat##i.post, absorb(state OCC_CODE year) vce(cluster i.occ_fe##i.year)
eststo: qui reghdfe A_MEDIAN i.treat##i.post, absorb(state OCC_CODE year) vce(cluster i.occ_fe##i.year)
esttab using "$outfile\IATable8A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear

u occwagefine_data_submission.dta

eststo clear
eststo: qui reghdfe A_MEAN i.treat##i.post, absorb(state OCC_CODE year) vce(cluster i.occ_fe##i.year)
eststo: qui reghdfe A_MEDIAN i.treat##i.post, absorb(state OCC_CODE year) vce(cluster i.occ_fe##i.year)
esttab using "$outfile\IATable8A.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label append

clear


*************************
*** TABLE A.8 PANEL B ***
*************************
u aggrinnov_data_submission.dta

eststo clear
eststo: qui reghdfe lead2lgrant i.treat##i.post, absorb(state gyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post, absorb(state gyear institute) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post, absorb(state gyear role) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post if role!="indiv", absorb(state gyear) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post if role!="indiv", absorb(state gyear role) vce(cluster state)
eststo: qui reghdfe lead2lgrant i.treat##i.post if role=="indiv", absorb(state gyear) vce(cluster state)
esttab using "$outfile\IATable8B.csv", keep(1.treat#1.post) b(%8.3f) se(%5.3f) ar2 nocons star(* 0.10 ** 0.05 *** 0.01) label replace

clear


******************
*** FIGURE A.1 ***
******************
u main_data_submission.dta

qui: reghdfe debtissue_lagat i.treat##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(95) title("LTD issuance") xtitle("") ytitle("Treatment effect") ylabel(,labsize(medsmall)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(issue, replace) graphregion(margin(vsmall)) 

qui: reghdfe totcollateral_debt i.treat##i.fyear i.d_xrd##i.fyear c.prepatstock##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(90) title("Pledged") xtitle("") ytitle("") ylabel(,labsize(small)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(pledged, replace) graphregion(margin(vsmall))

qui: reghdfe lead2lgrant i.treat##i.fyear i.d_xrd##i.fyear, absorb(gvkey ind_year_fe) vce(cluster state)
coefplot, keep(1.treat* ) vertical recast(connected) ciopts(recast(rcap)) level(90) coeflabels(1.treat#2004.fyear ="2004" 1.treat#2005.fyear =" " 1.treat#2006.fyear ="2006" 1.treat#2007.fyear =" " 1.treat#2008.fyear ="2008" 1.treat#2009.fyear =" " 1.treat#2010.fyear ="2010" 1.treat#2011.fyear =" " 1.treat#2012.fyear ="2012" 1.treat#2013.fyear =" ")  title("Log(1+patent)") xtitle("") ytitle("") ylabel(,labsize(medsmall)) xlabel(,labsize(small)) xline(5) yline(0) saving(grant, replace) graphregion(margin(vsmall))

qui: reghdfe bank_at i.treat##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(90) title("Bank Debt") xtitle("") ytitle("Treatment effect") ylabel(,labsize(medsmall)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(bank, replace) graphregion(margin(vsmall))

qui: reghdfe lsumselfcite i.treat##i.fyear c.prepatstock##i.fyear i.d_xrd##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(95) title("Log(1+self citation)") xtitle("") ytitle("") ylabel(,labsize(medsmall)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(selfcite, replace) graphregion(margin(vsmall))

qui: ppmlhdfe ninvnm i.treat##i.fyear, d absorb(gvkey) vce(robust)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(90) title("Avg. inventors") xtitle("") ytitle("") ylabel(,labsize(medsmall)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(inventors, replace) graphregion(margin(vsmall))

qui: reghdfe lxrd i.treat##i.fyear, absorb(gvkey) vce(cluster state)
margins, dydx(treat) at(fyear=(2004(1)2013)) vsquish
marginsplot, level(90) title("Log(R&D expense)") xtitle("") ytitle("") ylabel(,labsize(medsmall)) xlabel(2004(2)2013,labsize(small)) xline(2008) yline(0) xtick(2004(2)2013) xmtick(2005(2)2013,tlength(2)) saving(deploy, replace) graphregion(margin(vsmall))

graph combine issue.gph deploy.gph pledged.gph grant.gph bank.gph selfcite.gph inventors.gph , row(2) 
graph export "$outfile\FigureA2.png", replace

clear


******************
*** FIGURE A.2 ***
******************
u aggrinnov.dta

bys treat gyear: egen meanlead2lgrant=mean(lead2lgrant)
twoway line meanlead2lgrant gyear if treat==1, lcolor(red) ytitle("Log(1+grant)") xtitle("Year")|| line meanlead2lgrant gyear if treat==0, lcolor(blue) xline(2008, lcolor(black)) legend(lab(1 "Treated") lab(2 "Control")) 
graph save "$outfile\figureA3.png"


